<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div class="app">
      <ul>
        <li v-for="(item,index) in peopleList" :key="item.id">
          <p>{{item.text}}</p>
        </li>
      </ul>
      <button @click="walk">走一走</button>
    </div>
    <script src="../work1/js/vue.js"></script>
    <script>
      const app = new Vue({
        el: ".app",
        data: {
          peopleList: [
            { id: 1, text: "帅哥" },
            { id: 2, text: "美女" },
            { id: 3, text: "程序员" },
          ],
        },
        methods: {
          walk() {
            if (this.peopleList[0].text === "帅哥") {
              this.peopleList = [
                { id: 1, text: "美女" },
                { id: 2, text: "程序员" },
                { id: 3, text: "帅哥" },
              ];
              return;
            }
            if (this.peopleList[0].text === "美女") {
              this.peopleList = [
                { id: 1, text: "程序员" },
                { id: 2, text: "帅哥" },
                { id: 3, text: "美女" },
              ];
              return;
            }
            if (this.peopleList[0].text === "程序员") {
              this.peopleList = [
                { id: 1, text: "帅哥" },
                { id: 2, text: "美女" },
                { id: 3, text: "程序员" },
              ];
              return;
            }
          },
        },
      });
    </script>
  </body>
</html>
